package com.daoeping.data;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * Usr_training entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "usr_training", catalog = "daoeping")
public class Usr_training implements java.io.Serializable {

	// Fields

	private Integer id;
	private Usr_user usr_user;
	private Bsc_trainingschool bsc_trainingschool;
	private String name;
	private Date startDate;
	private Date endDate;
	private String description;
	private Set<Usr_certificateref> usr_certificaterefs = new HashSet<Usr_certificateref>(
			0);

	// Constructors

	/** default constructor */
	public Usr_training() {
	}

	/** minimal constructor */
	public Usr_training(Usr_user usr_user, Bsc_trainingschool bsc_trainingschool) {
		this.usr_user = usr_user;
		this.bsc_trainingschool = bsc_trainingschool;
	}

	/** full constructor */
	public Usr_training(Usr_user usr_user,
			Bsc_trainingschool bsc_trainingschool, String name, Date startDate,
			Date endDate, String description,
			Set<Usr_certificateref> usr_certificaterefs) {
		this.usr_user = usr_user;
		this.bsc_trainingschool = bsc_trainingschool;
		this.name = name;
		this.startDate = startDate;
		this.endDate = endDate;
		this.description = description;
		this.usr_certificaterefs = usr_certificaterefs;
	}

	// Property accessors
	@Id
	@GeneratedValue
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "user_id", nullable = false)
	public Usr_user getUsr_user() {
		return this.usr_user;
	}

	public void setUsr_user(Usr_user usr_user) {
		this.usr_user = usr_user;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "trainingschool_id", nullable = false)
	public Bsc_trainingschool getBsc_trainingschool() {
		return this.bsc_trainingschool;
	}

	public void setBsc_trainingschool(Bsc_trainingschool bsc_trainingschool) {
		this.bsc_trainingschool = bsc_trainingschool;
	}

	@Column(name = "name", length = 100)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "start_date", length = 10)
	public Date getStartDate() {
		return this.startDate;
	}

	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "end_date", length = 10)
	public Date getEndDate() {
		return this.endDate;
	}

	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}

	@Column(name = "description", length = 200)
	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "usr_training")
	public Set<Usr_certificateref> getUsr_certificaterefs() {
		return this.usr_certificaterefs;
	}

	public void setUsr_certificaterefs(
			Set<Usr_certificateref> usr_certificaterefs) {
		this.usr_certificaterefs = usr_certificaterefs;
	}

}